package utils

import "encoding/base64"

type Coder struct {
}

func (m Coder) Encode(data string) string {
	encodeStr := base64.StdEncoding.EncodeToString([] byte(data))
	return encodeStr
}

func (m Coder) Decode(encodeStr string) (string, error)  {
	decodeData, err := base64.StdEncoding.DecodeString(encodeStr)
	if err != nil {
		return "", err
	}

	return string(decodeData), nil
}